package edu.hcmiu.portal.model.impl;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;

import edu.hcmiu.portal.model.hook_activity;
import edu.hcmiu.portal.model.hook_activitySoap;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * <a href="hook_activityModelImpl.java.html"><b><i>View Source</i></b></a>
 *
 * <p>
 * ServiceBuilder generated this class. Modifications in this class will be
 * overwritten the next time is generated.
 * </p>
 *
 * <p>
 * This class is a model that represents the <code>hook_activity</code> table
 * in the database.
 * </p>
 *
 * @author Brian Wing Shun Chan
 *
 * @see edu.hcmiu.portal.model.hook_activity
 * @see edu.hcmiu.portal.model.hook_activityModel
 * @see edu.hcmiu.portal.model.impl.hook_activityImpl
 *
 */
public class hook_activityModelImpl extends BaseModelImpl<hook_activity> {
    public static final String TABLE_NAME = "hook_activity";
    public static final Object[][] TABLE_COLUMNS = {
            { "actID", new Integer(Types.BIGINT) },
            

            { "actName", new Integer(Types.VARCHAR) },
            

            { "userID", new Integer(Types.BIGINT) },
            

            { "catID", new Integer(Types.BIGINT) },
            

            { "taglistID", new Integer(Types.BIGINT) },
            

            { "actTime", new Integer(Types.TIMESTAMP) },
            

            { "actDuration", new Integer(Types.INTEGER) },
            

            { "actSubject", new Integer(Types.VARCHAR) },
            

            { "actModel", new Integer(Types.VARCHAR) },
            

            { "actFrequency", new Integer(Types.INTEGER) }
        };
    public static final String TABLE_SQL_CREATE = "create table hook_activity (actID LONG not null primary key,actName VARCHAR(75) null,userID LONG,catID LONG,taglistID LONG,actTime DATE null,actDuration INTEGER,actSubject VARCHAR(75) null,actModel VARCHAR(75) null,actFrequency INTEGER)";
    public static final String TABLE_SQL_DROP = "drop table hook_activity";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.edu.hcmiu.portal.model.hook_activity"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.edu.hcmiu.portal.model.hook_activity"),
            true);
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.edu.hcmiu.portal.model.hook_activity"));
    private long _actID;
    private String _actName;
    private long _userID;
    private long _catID;
    private long _taglistID;
    private Date _actTime;
    private int _actDuration;
    private String _actSubject;
    private String _actModel;
    private int _actFrequency;
    private transient ExpandoBridge _expandoBridge;

    public hook_activityModelImpl() {
    }

    public static hook_activity toModel(hook_activitySoap soapModel) {
        hook_activity model = new hook_activityImpl();

        model.setActID(soapModel.getActID());
        model.setActName(soapModel.getActName());
        model.setUserID(soapModel.getUserID());
        model.setCatID(soapModel.getCatID());
        model.setTaglistID(soapModel.getTaglistID());
        model.setActTime(soapModel.getActTime());
        model.setActDuration(soapModel.getActDuration());
        model.setActSubject(soapModel.getActSubject());
        model.setActModel(soapModel.getActModel());
        model.setActFrequency(soapModel.getActFrequency());

        return model;
    }

    public static List<hook_activity> toModels(hook_activitySoap[] soapModels) {
        List<hook_activity> models = new ArrayList<hook_activity>(soapModels.length);

        for (hook_activitySoap soapModel : soapModels) {
            models.add(toModel(soapModel));
        }

        return models;
    }

    public long getPrimaryKey() {
        return _actID;
    }

    public void setPrimaryKey(long pk) {
        setActID(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_actID);
    }

    public long getActID() {
        return _actID;
    }

    public void setActID(long actID) {
        _actID = actID;
    }

    public String getActName() {
        return GetterUtil.getString(_actName);
    }

    public void setActName(String actName) {
        _actName = actName;
    }

    public long getUserID() {
        return _userID;
    }

    public void setUserID(long userID) {
        _userID = userID;
    }

    public long getCatID() {
        return _catID;
    }

    public void setCatID(long catID) {
        _catID = catID;
    }

    public long getTaglistID() {
        return _taglistID;
    }

    public void setTaglistID(long taglistID) {
        _taglistID = taglistID;
    }

    public Date getActTime() {
        return _actTime;
    }

    public void setActTime(Date actTime) {
        _actTime = actTime;
    }

    public int getActDuration() {
        return _actDuration;
    }

    public void setActDuration(int actDuration) {
        _actDuration = actDuration;
    }

    public String getActSubject() {
        return GetterUtil.getString(_actSubject);
    }

    public void setActSubject(String actSubject) {
        _actSubject = actSubject;
    }

    public String getActModel() {
        return GetterUtil.getString(_actModel);
    }

    public void setActModel(String actModel) {
        _actModel = actModel;
    }

    public int getActFrequency() {
        return _actFrequency;
    }

    public void setActFrequency(int actFrequency) {
        _actFrequency = actFrequency;
    }

    public hook_activity toEscapedModel() {
        if (isEscapedModel()) {
            return (hook_activity) this;
        } else {
            hook_activity model = new hook_activityImpl();

            model.setNew(isNew());
            model.setEscapedModel(true);

            model.setActID(getActID());
            model.setActName(HtmlUtil.escape(getActName()));
            model.setUserID(getUserID());
            model.setCatID(getCatID());
            model.setTaglistID(getTaglistID());
            model.setActTime(getActTime());
            model.setActDuration(getActDuration());
            model.setActSubject(HtmlUtil.escape(getActSubject()));
            model.setActModel(HtmlUtil.escape(getActModel()));
            model.setActFrequency(getActFrequency());

            model = (hook_activity) Proxy.newProxyInstance(hook_activity.class.getClassLoader(),
                    new Class[] { hook_activity.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public ExpandoBridge getExpandoBridge() {
        if (_expandoBridge == null) {
            _expandoBridge = new ExpandoBridgeImpl(hook_activity.class.getName(),
                    getPrimaryKey());
        }

        return _expandoBridge;
    }

    public Object clone() {
        hook_activityImpl clone = new hook_activityImpl();

        clone.setActID(getActID());
        clone.setActName(getActName());
        clone.setUserID(getUserID());
        clone.setCatID(getCatID());
        clone.setTaglistID(getTaglistID());
        clone.setActTime(getActTime());
        clone.setActDuration(getActDuration());
        clone.setActSubject(getActSubject());
        clone.setActModel(getActModel());
        clone.setActFrequency(getActFrequency());

        return clone;
    }

    public int compareTo(hook_activity hook_activity) {
        long pk = hook_activity.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        hook_activity hook_activity = null;

        try {
            hook_activity = (hook_activity) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = hook_activity.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{actID=");
        sb.append(getActID());
        sb.append(", actName=");
        sb.append(getActName());
        sb.append(", userID=");
        sb.append(getUserID());
        sb.append(", catID=");
        sb.append(getCatID());
        sb.append(", taglistID=");
        sb.append(getTaglistID());
        sb.append(", actTime=");
        sb.append(getActTime());
        sb.append(", actDuration=");
        sb.append(getActDuration());
        sb.append(", actSubject=");
        sb.append(getActSubject());
        sb.append(", actModel=");
        sb.append(getActModel());
        sb.append(", actFrequency=");
        sb.append(getActFrequency());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("edu.hcmiu.portal.model.hook_activity");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>actID</column-name><column-value><![CDATA[");
        sb.append(getActID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>actName</column-name><column-value><![CDATA[");
        sb.append(getActName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userID</column-name><column-value><![CDATA[");
        sb.append(getUserID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>catID</column-name><column-value><![CDATA[");
        sb.append(getCatID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>taglistID</column-name><column-value><![CDATA[");
        sb.append(getTaglistID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>actTime</column-name><column-value><![CDATA[");
        sb.append(getActTime());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>actDuration</column-name><column-value><![CDATA[");
        sb.append(getActDuration());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>actSubject</column-name><column-value><![CDATA[");
        sb.append(getActSubject());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>actModel</column-name><column-value><![CDATA[");
        sb.append(getActModel());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>actFrequency</column-name><column-value><![CDATA[");
        sb.append(getActFrequency());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
